﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using WebApiV3.Data;
using WebApiV3.Data.Entity;
using WebApiV3.Data.Helper;
using WebApiV3.Domain;

namespace WebApiV3.Api.Controllers
{
    [Route("[controller]")]
    [ApiController]
    public class TestController : ControllerBase
    {
        private Admin10086525DbContext _db;
        private readonly IRespository<Users> _userRespository;
        private readonly IRespository<Ranks> _rankRespository;

        public TestController(IRespository<Users> userRespository,IRespository<Ranks> rankRespository,Admin10086525DbContext dbContext)
        {
            _userRespository = userRespository;
            _rankRespository = rankRespository;
            _db = dbContext;
        }

        public string Get()
        {
            var lize = _db.Users.Include(x=>x.Ranks).ToList();
            return JsonHelper.SerializeObject(lize);
        }
    }
}